This is the third article in a series of articles on getting started with IBM's Db2 Database, a Relational Database Management System (RDBMS) that is part of a collection of data management and analysis software. The first article, Getting Started with IBM DB2 on Linux Part I: Background and Installation Preparation, discussed the installation methods and the process of preparing for installation; the second article, Getting Started with IBM DB2 on Linux Part II: Installation With DB2 Setup Wizard, detailed the installation process using the DB2 Setup GUI wizard, both directly on a computer with a fully configured desktop environment, and remotely through an SSH connection where the GUI display was forwarded from the remote computer to the local computer by the X Window System. In this article we describe the three manual installation methods for installing Db2 Database.
Three methods are available for installing Db2 Database manually on Linux. The first is the extraction of the compressed archives of Db2 components within the larger compressed installation image. The second is by using the db2_install tool. The third and the most robust is through a command that takes as an argument, a response file, such as that optionally created by the Db2 Setup wizard. These methods were briefly introduced in the first article of this series, Getting Started with IBM DB2 on Linux Part I: Background and Installation Preparation. Each of these methods is detailed in the Sections Installing by Extracting Payload Files, Installing by Using db2_install, and Installing by Using Response File with dbsetup, below.
This installation method is simply the extraction of a set of tar.gz archives contained within the larger installation image tar.gz archive downloaded from the IBM Db2 download page. In Part I of this article series, after transferring the downloaded image to the remote computer, the installation image was extracted into the directory /home/db2user/software. As suggested by the documentation, the resulting extracted directory was renamed from, /home/db2user/software/server_dec to /home/db2user/software/ibm-db2. Within this directory is the executable file mentioned in Part II of this article series that started the DB2 Setup GUI wizard, as well as some other tools, such as the manual installation script and the prerequisite checking tool. It also contains another directory which contains in a subdirectory several levels deeper, all of the discrete components of a Db2 Database installation as a set of tar.gz files. These files are in /home/db2user/software/ibm-db2/db2/linuxamd64/FILES.
Descriptions of these files are provided in /home/db2user/software/ibm-db2/db2/linuxamd64/ComponentList_server_dec.htm, grouped by whether they are required for installation, whether they are part of a typical installation, and whether they are optional. The following screenshot shows a main Ark window showing the contents of the archive and another Ark window displaying the component list file.
So, the task of installing using the payload files, is simply to extract the files in the "List of Required Components", and the desired files from the "List of Typical Components" and "List of Optional Components" into an Db2 installation directory. The extraction is performed by first creating the installation directory, changing to the directory, and, as root, extracting each of the components to install with the command:
tar xvzf component_file.tar.gz
/opt/ibm/db2/V11.5_03 was chosen as the installation directory following the convention described in the previous articles, where the default path for installations of multiple copies of Db2 on the same computer was described. Instead of extracting each file individually, a script to prepare the installation directory and extract the desired files based on a match of the first part of the file names could be used in order to avoid tedious and error prone typing. The script could also incorporate some of the manual configuration tasks required after the extraction of the components.
It should be noted that some files listed in the ComponentList_server_dec.htm should not be installed, according to the documentation; these are files beginning with PURESCALE_ and CF_, which are only for pureScale environments, and GSKNOINST which are for installations without encryption support. Components that are only necessary for non-root installations -- components with names containing _NR_ also should not be installed for the process described here. The following listing shows the files chosen for this installation.
/home/db2user/software/ibm-db2/db2/linuxamd64/FILES/BASE_CLIENT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/BASE_CLIENT_R_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/BASE_DB2_ENGINE_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/BASE_DB2_ENGINE_R_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/CLPPLUS_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/COMMUNICATION_SUPPORT_TCPIP_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/CONNECT_SUPPORT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/DATABASE_PARTITIONING_SUPPORT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/DB2_CONTROL_CENTER_HELP_EN_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/DB2_JAVA_HELP_EN_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/DB2_PRODUCT_MESSAGES_EN_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/EDB_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/ESE_PRODUCT_SIGNATURE_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/GSK_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/GSK_CRYPTO_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/ICU_SUP_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/ITLM_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/JAVA_COMMON_FILES_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/JAVA_RUNTIME_SUPPORT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/JAVA_SUPPORT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/JDK_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/REPL_CLIENT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/SQL_PROCEDURES_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/ACS_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/DB2_DATA_SOURCE_SUPPORT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/DB2_SAMPLE_DATABASE_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/DB2_UPDATE_SERVICE_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/FED_DATA_SOURCE_SUPPORT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/GUARDIUM_INST_MNGR_CLIENT_11.5.5.0_linuxamd64_x86_64.tar.gz /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/INSTANCE_SETUP_SUPPORT_11.5.5.0_linuxamd64_x86_64.tar.gz
The complete process for this installation method is listed below.
db2user@u1804-lab:~$ su - root Password: root@u1804-lab:~#
root@u1804-lab:~# mkdir /opt/ibm/db2/V11.5_03In this case, the installation directory contains _03 because it is the third installation of Db2 version 11.05.
root@u1804-lab:~# cd /opt/ibm/db2/V11.5_03
root@u1804-lab:/opt/ibm/db2/V11.5_03# tar xvzf /home/db2user/software/ibm-db2/db2/linuxamd64/FILES/BASE_CLIENT_11.5.5.0_linuxamd64_x86_64.tar.gz
root@u1804-lab:/home/db2user# ls -l /opt/ibm/db2/V11.5_03 total 148 drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 acs drwxr-xr-x 2 bin bin 4096 Nov 1 17:35 adm drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 adsm drwxr-xr-x 3 bin bin 4096 Nov 1 17:34 bin drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 bnd drwxr-xr-x 3 bin bin 4096 Nov 1 17:33 cfg drwxr-xr-x 4 bin bin 4096 Nov 1 17:33 conv drwxr-xr-x 7 bin bin 4096 Nov 1 17:33 das drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 dasfcn drwxr-xr-x 5 bin bin 4096 Nov 1 17:34 desktop drwxr-xr-x 3 bin bin 4096 Nov 1 17:34 doc drwxr-xr-x 3 bin bin 4096 Nov 1 17:33 function drwxr-xr-x 3 bin bin 4096 Nov 1 17:34 gskit drwxr-xr-x 2 bin bin 4096 Nov 1 17:34 guardium drwxr-xr-x 5 bin bin 4096 Nov 1 17:33 ha drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 include drwxr-xr-x 4 bin bin 4096 Nov 1 17:33 infopop drwxr-xr-x 3 bin bin 4096 Nov 1 17:33 install drwxr-xr-x 4 bin bin 4096 Nov 1 17:34 instance drwxr-xr-x 3 bin bin 4096 Nov 1 17:34 java drwxr-xr-x 5 bin bin 4096 Nov 1 17:33 json drwxr-xr-x 4 bin bin 4096 Nov 1 17:34 lib32 drwxr-xr-x 4 bin bin 12288 Nov 1 17:33 lib64 drwxr-xr-x 41 bin bin 4096 Nov 1 17:33 license lrwxrwxrwx 1 root root 12 Nov 1 17:33 logs -> install/logs drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 map drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 misc drwxr-xr-x 3 bin bin 4096 Nov 1 17:34 msg drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 pd drwxr-xr-x 3 bin bin 4096 Nov 1 17:34 properties drwxr-xr-x 3 bin bin 4096 Nov 1 17:33 python drwxr-xr-x 2 bin bin 4096 Nov 1 17:33 Readme drwxr-xr-x 12 bin bin 4096 Nov 1 17:33 samples drwxr-xr-x 3 bin bin 4096 Nov 1 17:33 security32 drwxr-xr-x 3 bin bin 4096 Nov 1 17:33 security64 drwxr-xr-x 3 bin bin 4096 Nov 1 17:35 tools root@u1804-lab:/home/db2user#
root@u1804-lab:/home/db2user# cd /opt/ibm/db2/V11.5_03/install root@u1804-lab:/opt/ibm/db2/V11.5_03/install# ./db2chgpathAlternatively, the full path of the command could be given without changing directories, as in
root@u1804-lab:/home/db2user# /opt/ibm/db2/V11.5_03/install/db2chgpath(This is an example of an installation copy specific command: the executable file is within a specific copy's installation directory and acts on the specific installation copy. Other commands are not only installation copy specific, but instance specific as well -- their executables are located within an instance's home directory and act on that specific instance.) The output of a successful completion of this command is as follows:
The output will be saved in /tmp/db2chgpath.log.24523 Starting the update of runtime path ... Sat Jan 23 19:10:29 EST 2021 Changing the embedded runtime path for DB2 deliverables installed under /opt/ibm/db2/V11.5_03 from /opt/ibm/db2/V11.5/ to /opt/ibm/db2/V11.5_03/ ---> Please wait Output was saved in the log file /tmp/db2chgpath.log.24523 Sat Jan 23 19:10:49 EST 2021 Program db2chgpath completed successfully.
root@u1804-lab:~# useradd -c "db2inst3 instance owner" -g 130 -m -s /bin/bash -N -d /home/db2inst3 db2inst3 root@u1804-lab:~# passwd db2inst3 Enter new UNIX password: Retype new UNIX password: passwd: password updated successfullyIn the above useradd command, the username db2inst3 is chosen following the convention used by DB2 Setup wizard. This user will be the instance owner of the third instance created on this computer, hence the 3 in the username. The following listing shows the existing users with db2 in their usernames before creating the user. The last four entries in the output are those users created by the wizard during the two installations described in the previous article.
root@u1804-lab:~# cat /etc/passwd | grep db2 db2user:x:1001:1001:,,,,db2 administrator:/home/db2user:/bin/bash db2inst1:x:1002:130::/home/db2inst1:/bin/sh db2fenc1:x:1003:131::/home/db2fenc1:/bin/sh db2inst2:x:1004:130::/home/db2inst2:/bin/sh db2fenc2:x:1005:131::/home/db2fenc2:/bin/shThe primary user group db2iadm1 (GID 130) created by the wizard in the first installation of Db2 to be used as the instance owner of the instance created as part of that installation, and used again by the wizard as the primary user group of the second instance owner of the instance created as part of the second installation, is used as the primary user group of the new user created by the useradd here. The listing below shows the existing groups with db2 in their names before creating the user. db2iadm1 and db2fadm1 were created by the first invocation of the GUI wizard in the previous to act as the primary user group of the first instance owning user and the primary user group of the first instance fenced user, respectively.
root@u1804-lab:~# cat /etc/group | grep db2 sudo:x:27:db2user,labuser db2user:x:1001: db2iadm1:x:130: db2fadm1:x:131:The next listing shows the group memberships of the instance owning users before creating the new user.
root@u1804-lab:~# id db2inst1 uid=1002(db2inst1) gid=130(db2iadm1) groups=130(db2iadm1) root@u1804-lab:~# id db2inst2 uid=1004(db2inst2) gid=130(db2iadm1) groups=130(db2iadm1) root@u1804-lab:~#The user created in this step will be the instance owner of a new instance created later in Step 9 that will be associated with the Db2 copy installed in this process; the user to act as instance owner must exist before creating the instance. See Getting Started with DB2 on Linux for information on the relationship between an instance owning user and an instance.
root@u1804-lab:~# useradd -c "db2fenc3 instance fenced user" -g 131 -m -s /bin/bash -N -d /home/db2fenc3 db2fenc3 root@u1804-lab:~# passwd db2fenc3 Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@u1804-lab:~#The username db2fenc3 was chosen for reasons given in the previous step. The user is assigned primary user group db2fadm1 (GID 131), described in the previous step. See Getting Started with DB2 on Linuxfor information on the relationship between an instance fenced user and an instance.
root@u1804-lab:~# /opt/ibm/db2/V11.5_03/instance/db2icrt -a server -u db2fenc3 db2inst3Note that the full path of the command is given, and that the executable is in a directory named instance within the installation directory of the Db2 copy installed by the current process. This installation copy specific command associates the created instance with the specific installation copy whose installation directory contains the executed command. If the db2icrt contained in the instance directory of the installation directory of another copy were to be executed, the created instance would be associated with that other Db2 copy. In the above command, the argument of the option -u is the fenced user of the instance; the last argument of the command is the instance name of the instance to be created by the command. A user with the same name as the instance to be created with a home directory of the same name must exist before executing the command; the indicated fenced user must also exist and must have a home directory. The output of a successful completion of the command is shown below:
root@u1804-lab:~# /opt/ibm/db2/V11.5_03/instance/db2icrt -a server -u db2fenc3 db2inst3 DBI1446I The db2icrt command is running. DB2 installation is being initialized. Total number of tasks to be performed: 4 Total estimated time for all tasks to be performed: 309 second(s) Task #1 start Description: Setting default global profile registry variables Estimated time 1 second(s) Task #1 end Task #2 start Description: Initializing instance list Estimated time 5 second(s) Task #2 end Task #3 start Description: Configuring DB2 instances Estimated time 300 second(s) Task #3 end Task #4 start Description: Updating global profile registry Estimated time 3 second(s) Task #4 end The execution completed successfully. For more information see the DB2 installation log at "/tmp/db2icrt.log.14306". DBI1070I Program db2icrt completed successfully. root@u1804-lab:~#The execution of the instance creation command registers the installation in the Db2 global registry. If not creating an instance, use the db2ilst command to view information on known instances, the execution of which also registers the installation.
S,DB2,11.5.5.0,/opt/ibm/db2/V11.5,,,0,0,,1609285017,0 ... S,DB2,11.5.5.0,/opt/ibm/db2/V11.5_01,,,0,0,,1610327461,0 ... S,DB2,11.5.5.0,/opt/ibm/db2/V11.5_03,-,,0,,,1611448740,0 ...in the following listing, which shows the output of the db2reg command, displays the versions and installation paths of the copies. In each line above the third comma-separated field is the version and the fourth field is the path. In this case all three copies are at version 11.5.5.0.
root@u1804-lab:~# db2greg -dump S,DB2,11.5.5.0,/opt/ibm/db2/V11.5,,,0,0,,1609285017,0 V,DB2GPRF,DB2SYSTEM,u1804-lab,/opt/ibm/db2/V11.5, I,DB2,11.5.5.0,db2inst1,/home/db2inst1/sqllib,,1,0,/opt/ibm/db2/V11.5,, S,TSA,4.1.0.5,/opt/IBM/tsamp,DG_NOT_ALLOWED,DB2_INSTALLED,0,0,-,1610327432,0 S,RSCT,3.2.4.4,/usr/sbin/rsct,DG_NOT_ALLOWED,DB2_INSTALLED,0,0,-,1610327432,0 S,DB2,11.5.5.0,/opt/ibm/db2/V11.5_01,,,0,0,,1610327461,0 V,DB2GPRF,DB2SYSTEM,u1804-lab,/opt/ibm/db2/V11.5_01, I,DB2,11.5.5.0,db2inst2,/home/db2inst2/sqllib,,1,0,/opt/ibm/db2/V11.5_01,, S,DB2,11.5.5.0,/opt/ibm/db2/V11.5_03,-,,0,,,1611448740,0 V,DB2GPRF,DB2SYSTEM,u1804-lab,/opt/ibm/db2/V11.5_03, I,DB2,11.5.5.0,db2inst3,/home/db2inst3/sqllib,,1,0,/opt/ibm/db2/V11.5_03,,Since all versions are 11.5.5.0, this step is not necessary in this case, but if they were different, it would be necessary to ensure that the symbolic link /usr/local/bin/db2ls points to the executable db2ls contained in the installation directory of a copy with the highest version. In the listing below, the symbolic link is to a db2ls in the install directory under the installation path of the first copy installed on the system.
root@u1804-lab:~# ls -l /usr/local/bin | grep db2ls lrwxrwxrwx 1 root root 32 Jan 10 20:11 db2ls -> /opt/ibm/db2/V11.5/install/db2lsIf this installation directory were for a copy of Db2 lower than any other version the link would have to be adjusted.
/opt/ibm/db2/V11.5_03/bin/db2fmcu -u -p /etc/inittabNote, again, the full path of the command is within the installation directory of the copy of Db2 installed by the current procedure.
db2inst3@u1804-lab:~$ db2start 02/22/2021 13:51:53 0 0 SQL8000N DB2START processing failed; a valid product license was not found. If you have licensed this product, ensure the license key is properly registered. You can register the license using the db2licm command. The license key can be obtained from your licensed product CD. SQL1032N No start database manager command was issued. SQLSTATE=57019Db2 licenses are managed with the db2licm tool. It can display the license status and compliance of installed Db2 products, as well as apply and remove licenses to and from installed Db2 products. To apply a license, the command is used with the -a option which takes as an argument a license file. The installation image includes numerous licenses for different Db2 server editions, with the applied license file, in effect, determining the installed edition of Db2 Database. The license files are located in the installation image in the directory /home/db2user/software/ibm-db2/db2/license (after /home/db2user/software/server_dec has been renamed to /home/db2user/software/ibm-db, see Getting Started with IBM DB2 on Linux Part I: Background and Installation Preparation). Of the licenses contained in this directory, the file db2dec.lic is the correct one for Db2 Community Edition which provides a permanent license, although with the limitations described in the first article of the series. The following listing show the execution of the command to apply the license and its output. Note that although the license files are outside of any path associated with the Db2 installation or the instance home, it is executed by the instance owner of the instance associated with this installation of Db2.
db2inst3@u1804-lab:/home/db2user/software/ibm-db2/db2/license$ db2licm -a db2dec.lic LIC1402I License added successfully. LIC1426I This product is now licensed for use as outlined in your License Agreement. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, LOCATED IN THE FOLLOWING DIRECTORY: "/opt/ibm/db2/V11.5_03/license/en_US.iso88591"db2licm with the -l option to view installed products and their license status as in:
db2inst3@u1804-lab:/home/db2user/software/ibm-db2/db2/license$ db2licm -l Product name: "DB2 Community Edition" License type: "Community" Expiry date: "Permanent" Product identifier: "db2dec" Version information: "11.5" Max amount of memory (GB): "16" Max number of cores: "4" db2inst3@u1804-lab:/home/db2user/software/ibm-db2/db2/license$
A cursory verification that the manual installation process described above was successful with the db2ls command, as shown in the following listing. It shows all installed copies of Db2 along with their installation directories, versions, and installation dates.
root@u1804-lab:~# db2ls Install Path Level Fix Pack Special Install Number Install Date Installer UID --------------------------------------------------------------------------------------------------------------------- /opt/ibm/db2/V11.5 11.5.5.0 0 Tue Dec 29 18:36:57 2020 EST 0 /opt/ibm/db2/V11.5_01 11.5.5.0 0 Sun Jan 10 20:11:01 2021 EST 0 /opt/ibm/db2/V11.5_03 11.5.5.0 0 Sat Jan 23 19:39:00 2021 EST 0 root@u1804-lab:~#The installation validation tool mentioned in the previous article in this series could also be used.
Another manual installation method is available in the form of a stub shell script that essentially automates the payload extraction method described above for Db2 Database server installation. It can also perform updates and installation of other products. It offers the convenience of not requiring the configuration steps in the payload extraction method described in the previous section, only requiring an instance and the necessary instance users to be created, also as described in the previous section.
When DB2 Server Edition is the product to be installed, the tool installs all required and optional components except those for systems without encryption support and the components for non-root installations. Options are available to force the installation of the pureScale components which are not appropriate for this example, and to prevent the installation of IBM Tivoli® System Automation for Multiplatforms. If a previous installation included IBM Tivoli® System Automation for Multiplatforms, the script will recognize it and make it available for use with the new installation.
The script, named db2_install, is located in the same directory as the the prerequisite checking tool and the setup wizard executable files, namely /home/db2user/software/ibm-db2. This directory was created by extracting the downloaded installation image and renaming a subdirectory in the result of the extraction. (See Getting Started with IBM DB2 on Linux Part I: Background and Installation Preparation.)
The installation process with this method is detailed below:
db2user@u1804-lab:~$ su - root Password: root@u1804-lab:~#
root@u1804-lab:~# /home/db2user/software/ibm-db2/db2_install -y -f NOTSAMP -p server -b /opt/ibm/db2/V11.5_02 -nThe options have the following effects:
-n
Non-interactive mode.-y
Accept license terms automatically. This option is required if -n
is also used.-b
Specify the installation directory as an option argument.-p
Specify Db2 product. Option arguments include client and server among others.-f
Specify installed feature characteristics as option arguments. NOTSAMP
in the example prevents IBM Tivoli® System Automation for Multiplatforms from being installed.root@u1804-lab:~# cd /home/db2user/software/ibm-db2 root@u1804-lab:~# ./db2_install -y -f NOTSAMP -p server -b /opt/ibm/db2/V11.5_02 -nThe output of a successful completion of the command is shown below:
root@u1804-lab:~# /home/db2user/software/ibm-db2/db2_install -y -f NOTSAMP -p server -b /opt/ibm/db2/V11.5_02 -n The execution completed successfully. For more information see the DB2 installation log at "/tmp/db2_install.log.29960". root@u1804-lab:~#
The last manual installation method is an installation using a response file. This method uses the command db2setup, taking as an argument a response file that contains the configuration of the installation, specifying such items as the installation directory, components to be installed, instances to be created that will be associated with the installed copy, instance owner and fenced instance user to be created, networking communication settings, among many others. The response files can be created by using the following methods:
In the process presented below, the sample Db2 server installation response file is used as a starting point for generating a response file to be used to install another copy of Db2 Database. The sample files, with an extension of .rsp, are located in the extracted installation image (Getting Started with IBM DB2 on Linux Part I: Background and Installation Preparation), in the renamed directory /home/db2user/software/ibm-db2/db2/linuxamd64/samples. The following listing shows the contents of the directory.
root@u1804-lab:~# ls -l /home/db2user/software/ibm-db2/db2/linuxamd64/samples total 172 -r--r--r-- 1 bin bin 27620 Nov 1 17:49 db2client.rsp -r--r--r-- 1 bin bin 43426 Nov 1 17:49 db2consv.rsp -r--r--r-- 1 bin bin 26175 Nov 1 17:49 db2rtcl.rsp -r--r--r-- 1 bin bin 57478 Nov 1 17:49 db2server.rsp -r--r--r-- 1 bin bin 9596 Nov 1 17:49 db2un.rsp
db2server.rsp is the server response file. It is a well documented -- through comments -- file of 930 lines, that contains all possible configuration items. The basic format of the file is a configuration item keyword then an equals sign followed by the value to set for the configuration item, as in for example,
FILE = /opt/ibm/db2/V11.5
If a configuration item can be assigned more than one value, the keyword is repeated on multiple lines and assigned a different value in each line. The configuration item INSTANCE
is one such configuration item. Multiple values can be assigned to this item, as in the following:
INSTANCE = inst1 INSTANCE = inst2 INSTANCE = inst3
where INSTANCE is assigned the values inst1, inst2, and inst3.
The comment character is an asterisk (*
). Optional configuration items are commented out with a single asterisk while required items are not. In both cases, default values are assigned to the configuration item. Text that serves to document the contents are double commented -- with two asterisks instead of one, to help distinguish it from commented out configuration items. In the excerpts from the response file that follow, lines that begin with a single asterisk are comments as they exist in the original sample file, lines that begin with three asterisks are lines that contain configuration items that were not commented out in the original sample but in copied, commented out, and retained for information. The lines containing modified values of configuration items appear below their commented out counterparts.
The process to use a response file in installing Db2 Database is detailed below. Here, the sample response file is used as a starting point for generating the response file, but it is generally applicable to installation with response files generated by the other methods mentioned previously.
cp /home/db2user/software/ibm-db2/db2/linuxamd64/samples/db2server.rsp /home/db2user/db2copy5.rsp
FILE
configuration item to an appropriate path that is to be the installation directory of the new copy of Db2 to be installed. Even if it is the first copy, if additional copies are to be installed later, it may be desirable to change the installation directory from the default value to /opt/ibm/db2/v11.5_01. In the following listing, it has been modified from the default value of /opt/ibm/db2/v11.5 to /opt/ibm/db2/v11.5_05.
*** FILE = /opt/ibm/db2/V11.5 FILE = /opt/ibm/db2/V11.5_05
LIC_AGREEMENT
from DECLINE to ACCEPT.
*** LIC_AGREEMENT = DECLINE ** ACCEPT or DECLINE LIC_AGREEMENT = ACCEPT ** ACCEPT or DECLINE
INTERACTIVE
with a value of NONE. This will cause the installation to proceed without any prompts. A value of NONE here must be used with a value of ACCEPT for the LIC_AGREEMENT
keyword.
*INTERACTIVE = NONE ** NONE, YES, MACHINE INTERACTIVE = NONE ** NONE, YES, MACHINE
INSTALL_TYPE
value as desired. The possible values are TYPICAL, COMPACT, or CUSTOM, which specify, respectively, the installation the Db2 Database components shown in the "Typical" section of the ComponentList_server_dec.htm (Section Installing by Extracting Payload Files) file, a minimal set of components, or a custom selection of components. Whatever the choice, required components are installed automatically. If CUSTOM is selected, the components to be installed must be specified, as shown below.
*** INSTALL_TYPE = TYPICAL ** TYPICAL, COMPACT, CUSTOM INSTALL_TYPE = CUSTOM ** TYPICAL, COMPACT, CUSTOM
COMP
configuration item. A commented out line of the form
*COMP = Db2_COMPONENT_NAMEexists in the file for each of the installable Db2 Database components. Components to install can be specified by simply commenting out each line that sets the COMP value to a desired component to install. Like the
INSTANCE
configuration item, mentioned previously, COMP
is a configuration item that can be given multiple values, by assigning each value on a separate line. The following listing shows the COMP lines that were uncommented for this installation.
COMP = ACS ** Integrated Flash Copy Support COMP = DB2_SAMPLE_DATABASE ** Sample database source COMP = DB2_UPDATE_SERVICE ** DB2 Update Service COMP = FED_DATA_SOURCE_SUPPORT ** Federated Data Access Support COMP = GUARDIUM_INST_MNGR_CLIENT ** Guardium Installation Manager Client COMP = INSTANCE_SETUP_SUPPORT ** DB2 Instance Setup wizard COMP = IINR_APPLICATIONS_WRAPPER ** Application data sources COMP = IINR_SCIENTIFIC_WRAPPER ** Scientific Data Sources COMP = IINR_STRUCTURED_FILES_WRAPPER ** Structured file data sources COMP = JDBC_DATA_SOURCE_SUPPORT ** JDBC data source support COMP = ODBC_DATA_SOURCE_SUPPORT ** ODBC data source support COMP = TEXT_SEARCH ** DB2 Text Search
INSTANCE
. The values of the INSTANCE keyword are an identifier that allows multiple instances to be created as specified in the response file. Here the line containing the INSTANCE keyword, with a value of DB2_INST is commented out, and two INSTANCE lines are added, the first specifying an INSTANCE keyword value of inst1 and the second specifying inst2. The INSTANCE value in the response file created by the wizard, while only having one INSTANCE value used this format.
*** INSTANCE = DB2_INST ** char(8) no spaces INSTANCE = inst1 ** char(8) no spaces INSTANCE = inst2 ** char(8) no spacesThis keyword allows multiple instances to be created and configured in that these values are prefixed to instance configuration items when specifying the properties of each instance. For example, if two instances are to be created, the INSTANCE configuration item is assigned two values, as was done above. Instance specific configuration items are then prefixed with these values followed by a dot (
.
) to distinguish between the two instances, as in:
instance_value_1.instance_specific_configuration_item = instance_specific_configuration_item instance_value_2.instance_specific_configuration_item = instance_specific_configuration_itemThe prefix specifies to which instance the same instance configuration item applies. This will be apparent when actual instance specific configuration items are assigned, below.
*DB2_INST.NAME = db2inst1 ** char(8) no spaces, no upper case letters inst1.NAME = db2inst5 ** char(8) no spaces, no upper case letters inst2.NAME = db2inst6 ** char(8) no spaces, no upper case lettersHere we see how the values of the
INSTANCE
configuration values are used to prefix the instance configuration item, in this case NAME
. The username of the instance owning user of each instance will be the same as the instance name.
*** DB2_INST.GROUP_NAME = db2iadm1 ** char(30) no spaces inst1.GROUP_NAME = db2iadm1 ** char(30) no spaces inst2.GROUP_NAME = db2iadm1 ** char(30) no spacesThe primary user group name specified here will be created by the installer using the low level Linux utility groupadd to create the group if it does not already exist and a primary user group ID (GID) assigned. The GID to use for a newly created can be specified in another configuration item, but if it is not provided, a GID will be automatically assigned following the configuration of the groupadd command. In this case, the primary user group specified already exists as it was created by the Db2 Setup wizard (Getting Started with IBM DB2 on Linux Part I: Background and Installation Preparation) and the new instance owners will be assigned to this primary user group.
*** DB2_INST.HOME_DIRECTORY = ** char(64) no spaces. Valid for root installation only *** DB2_INST.PASSWORD = Replace with your password ** Valid for root installation only inst1.HOME_DIRECTORY = /home/db2inst5 ** char(64) no spaces. Valid for root installation only inst1.PASSWORD = db2inst5pass ** Valid for root installation only inst2.HOME_DIRECTORY = /home/db2inst6 ** char(64) no spaces. Valid for root installation only inst2.PASSWORD = db2inst6pass ** Valid for root installation onlyThe installer will create users with the same username as the instance names specified in Step 2.G using the low level Linux utility useradd and assign the users' password and home directory as specified here. The users' shell and other user properties will be according to the configuration files relevant to useradd (see man useradd).
*DB2_INST.TYPE = ESE ** DSF ESE WSE STANDALONE CLIENT inst1.TYPE = ESE ** DSF ESE WSE STANDALONE CLIENT inst2.TYPE = ESE ** DSF ESE WSE STANDALONE CLIENTThe possible vales for this instance specific configuration item are ESE (an instance for a Db2 server with local and remote clients, the default instance type for the two Enterprise Server editions), DSF (an instance for a Db2 pureScale® environment server with local and remote clients. the default for use in a Db2 pureScale® environment), WSE (an instance for a Db2 server with local and remote clients, the default instance type for the Workgroup Server Edition), STANDALONE (an instance for a Db2 server with only local clients), CLIENT (an instance for a client such as IBM Data Server Client and IBM Data Server Runtime Client, for which this instance type is the default).
*** DB2_INST.AUTOSTART = YES ** YES or NO inst1.AUTOSTART = YES ** YES or NO inst2.AUTOSTART = YES ** YES or NO
*** DB2_INST.START_DURING_INSTALL = YES ** YES or NO. Default is YES. inst1.START_DURING_INSTALL = YES ** YES or NO. Default is YES. inst2.START_DURING_INSTALL = YES ** YES or NO. Default is YES.
SVCNAME
optional configuration item. This is one of the instance specific configuration items necessary for network communication to the instances created by the installation.
*DB2_INST.SVCENAME = db2c_db2inst1 ** BLANK or char(14). Reserved for root installation only *DB2_INST.SVCENAME = db2c_db2inst1 ** BLANK or char(14). Reserved for root installation only inst1.SVCENAME = db2c_db2inst5 ** BLANK or char(14). Reserved for root installation only inst2.SVCENAME = db2c_db2inst6 ** BLANK or char(14). Reserved for root installation onlyHere the configuration item is set following the format of the commented out line in the original sample file. The
SVCNAME
in the original file follows the format "db2c_" followed by the instance name of the instance to which it applies.
SVCNAME
is set.
*DB2_INST.PORT_NUMBER = 50000 ** 1024 - 65535, Reserved for root installation only inst1.PORT_NUMBER = 50004 ** 1024 - 65535, Reserved for root installation only inst2.PORT_NUMBER = 50005 ** 1024 - 65535, Reserved for root installation onlyIn the first two installations of Db2 Database, described in Getting Started with IBM DB2 on Linux Part II: Installation With DB2 Setup Wizard, the wizard used the default port numbers of 50000 and 50001. Here port number values of 50004 and 50005 are assigned to the two instances created by this installation, reserving the intermediate port numbers -- although not configured in this procedure -- for instances created by the previously described manual installation methods. The port numbers specified correspond to the instance name in that the last digit of the port number chosen for each instance is the same as the last character of the instance name.
FCM_PORT_NUMBER
and MAX_LOGICAL_NODE
for each instance. These values define a range of ports reserved for each instance during installation. The range for an ESE instance is between FCM_PORT_NUMBER and MAX_LOGICAL_NODE.
*DB2_INST.FCM_PORT_NUMBER = 60000 ** 1024 - 65535, the beginning port number. *DB2_INST.MAX_LOGICAL_NODES = ** 1 - 128 for DSF instances or 1 - 199 for ESE instances. inst1.FCM_PORT_NUMBER = 60040 ** 1024 - 65535, the beginning port number. inst1.MAX_LOGICAL_NODES = 6 ** 1 - 128 for DSF instances or 1 - 199 for ESE instances. inst2.FCM_PORT_NUMBER = 60050 ** 1024 - 65535, the beginning port number. inst2.MAX_LOGICAL_NODES = 6 ** 1 - 128 for DSF instances or 1 - 199 for ESE instances.
*** DB2_INST.FENCED_USERNAME = db2sdfe1 ** char(8) no spaces, no upper case letters inst1.FENCED_USERNAME = db2fenc5 ** char(8) no spaces, no upper case letters inst2.FENCED_USERNAME = db2fenc6 ** char(8) no spaces, no upper case lettersHere the convention of the setup wizard in names is followed. The last character is the same as the the last character in the instance name and thus the same as the last character in the instance owner username. The installer will create the specified user if it does not already exist using the useradd command. Another setting also exists to manually specify the user ID (UID) of the fenced user, but if not specified the installer will automatically assign one (following the configuration of useradd).
*** DB2_INST.FENCED_GROUP_NAME = db2fsdm1 ** char(30) no spaces inst1.FENCED_GROUP_NAME = db2fadm1 ** char(30) no spaces inst2.FENCED_GROUP_NAME = db2fadm1 ** char(30) no spacesLike the primary user group assignment for the instance owner, if the specified group does not exist it is created by the installer and the GID assigned. If it does already exist the installer just assigns the new user to the group. The GID to use for a newly created can be specified in another configuration item, but if it is not provided, a GID will be automatically assigned following the configuration of the groupadd command. In this case, the primary user group specified for the fenced user is one that already exists as it was created by the Db2 Setup wizard (Getting Started with IBM DB2 on Linux Part II: Installation With DB2 Setup Wizard) and the new instance owners will be assigned to this primary user group.
*DB2_INST.FENCED_HOME_DIRECTORY = ** char(64) no spaces inst1.FENCED_HOME_DIRECTORY = /home/db2fenc5 ** char(64) no spaces inst2.FENCED_HOME_DIRECTORY = /home/db2fenc6 ** char(64) no spaces
*DB2_INST.FENCED_PASSWORD = ** char(8) inst1.FENCED_PASSWORD = db2fenc5pass ** char(8) inst2.FENCED_PASSWORD = db2fenc6pass ** char(8)
*DB2_INST.CONFIGURE_TEXT_SEARCH = NO ** YES or NO inst1.CONFIGURE_TEXT_SEARCH = YES ** YES or NO inst2.CONFIGURE_TEXT_SEARCH = YES ** YES or NO
TEXT_SEARCH_HTTP_SERVICE_NAME
.
*DB2_INST.TEXT_SEARCH_HTTP_SERVICE_NAME = db2j_db2inst1 ** BLANK or char(14). Valid for root installation only inst1.TEXT_SEARCH_HTTP_SERVICE_NAME = db2j_db2inst5 ** BLANK or char(14). Valid for root installation only inst2.TEXT_SEARCH_HTTP_SERVICE_NAME = db2j_db2inst6 ** BLANK or char(14). Valid for root installation onlyHere the configuration item is set following the format of the commented out line in the original sample file. The
TEXT_SEARCH_HTTP_SERVICE_NAME
in the original file follows the format "db2j_" followed by the instance name of the instance to which it applies.
*DB2_INST.TEXT_SEARCH_HTTP_PORT_NUMBER = 55000 ** Any unused port number from 1024 - 65535 inst1.TEXT_SEARCH_HTTP_PORT_NUMBER = 65005 ** Any unused port number from 1024 - 65535 inst2.TEXT_SEARCH_HTTP_PORT_NUMBER = 65006 ** Any unused port number from 1024 - 65535Here the port numbers specified correspond to the instance name in that the last digit of the port number chosen for each instance is the same as the last character of the instance name.
root@u1804-lab:/home/db2user/software/ibm-db2# ./db2setup -r /home/db2user/db2copy5.rsp -l /home/db2user/copy5rsp.log -t /home/db2user/copy5rsp.trcThe output of a successful completion of the command is shown below.
root@u1804-lab:/home/db2user/software/ibm-db2# ./db2setup -r /home/db2user/db2copy5.rsp -l /home/db2user/copy5rsp.log -t /home/db2user/copy5rsp.trc DBI1191I db2setup is installing and configuring DB2 according to the response file provided. Please wait. The execution completed successfully. For more information see the DB2 installation log at "/home/db2user/copy5rsp.log". root@u1804-lab:/home/db2user/software/ibm-db2#
The setup script, according to the response file settings, modified as above and other non-modified settings from the sample installed Db2 in /opt/ibm/db2/V11.5_05, creating the instances db2inst5 and db2inst6, as well as creating the necessary instance owners and fenced users necessary for these instances. The following listing shows the created installation directory and the relevant users at this point -- after installing two copies with an instance each using the wizard, manually installing by extracting the payload files and creating an instance, manually installing using the db2_install script (we did not create any instances or users after this installation method), and manually installing using the response file.
root@u1804-lab:/home/db2user/software/ibm-db2# ls -l /opt/ibm/db2 total 20 drwxr-xr-x 42 root root 4096 Dec 29 18:36 V11.5 drwxr-xr-x 40 root root 4096 Jan 10 20:11 V11.5_01 drwxr-xr-x 42 root root 4096 Jan 24 20:39 V11.5_02 drwxr-xr-x 38 root root 4096 Jan 24 20:37 V11.5_03 drwxr-xr-x 41 root root 4096 Jan 25 19:20 V11.5_05 root@u1804-lab:/home/db2user/software/ibm-db2# less /etc/passwd | grep db2 db2user:x:1001:1001:,,,,db2 administrator:/home/db2user:/bin/bash db2inst1:x:1002:130::/home/db2inst1:/bin/sh db2fenc1:x:1003:131::/home/db2fenc1:/bin/sh db2inst2:x:1004:130::/home/db2inst2:/bin/sh db2fenc2:x:1005:131::/home/db2fenc2:/bin/sh db2inst3:x:1006:130:db2inst3 instance owner:/home/db2inst3:/bin/bash db2fenc3:x:1007:131:db2fenc3 instance fenced user:/home/db2fenc3:/bin/bash db2inst5:x:1008:130::/home/db2inst5:/bin/sh db2fenc5:x:1009:131::/home/db2fenc5:/bin/sh db2inst6:x:1010:130::/home/db2inst6:/bin/sh db2fenc6:x:1011:131::/home/db2fenc6:/bin/sh root@u1804-lab:/home/db2user/software/ibm-db2# id db2inst5 uid=1008(db2inst5) gid=130(db2iadm1) groups=130(db2iadm1) root@u1804-lab:/home/db2user/software/ibm-db2# id db2inst6 uid=1010(db2inst6) gid=130(db2iadm1) groups=130(db2iadm1) root@u1804-lab:/home/db2user/software/ibm-db2# id db2fenc5 uid=1009(db2fenc5) gid=131(db2fadm1) groups=131(db2fadm1) root@u1804-lab:/home/db2user/software/ibm-db2# id db2fenc6 uid=1011(db2fenc6) gid=131(db2fadm1) groups=131(db2fadm1) root@u1804-lab:/home/db2user/software/ibm-db2#
As we have seen in this and the previous articles of this series, IBM offers many methods for installing Db2 Database, from the simple GUI of the Db2 Setup wizard and the equally simple CLI installation tool, db2_install, to the robust response filed based installation that allows for all configuration items to be declared in the input response file. Both the GUI wizard and the response file method are launched by the stub shell script db2setup -- with different options -- which then calls other tools as appropriate to perform the actual installation and provide an interface as necessary.
The next part of this series, , describes the use of the Db2 Setup wizard distributed with the installation image to install Db2 Database.